<?php

class Core_Agent_Component_Subject_View_Subject_Create extends Core_Agent_Share_View_Form {

    public function initialize() {
        $this->setTemplatePath('create');
    }

    protected function buildToolbar($toolbar) {
        $group = $toolbar->createGroup('back');
        $group->addLink($this->getHistoryUrl('subject/subject/index'),$this->__('share.button.back'));
        $group = $toolbar->createGroup('save');
        $group->addButton($this->__('share.button.save'))
        	  ->bindEvent('click', "Kdf.Ui.getForm('".$this->getForm()->getId()."').submit('".$this->getUrl(NULL, 'save')."')");
        parent::buildToolBar($toolbar);
    }

    protected function buildForm($form) {
        $entity = $this->getModel(NULL);
        $form->setAction($this->getUrl())
                ->setId('content_form')
                ->addHiddenField('id', 'content[id]');
        $form->addSelectField($this->__('subject.label.subject_theme'), 'theme_id', 'content[theme_id]')
                ->bindData($this->getThemes(),'title','id');
        if (!is_null($entity)) {
            $form->bindData($entity->getAllData());
        }
        parent::buildForm($form);
    }
}